import React, { useEffect } from 'react'
import { Button } from 'antd'
import EventHub from '../EventHub/index.jsx'
import { unique } from '../utils'


export function EButton({ params, superParams, index, }) {
  const { item, onClick, children, value, formType, release, ...other } = params || {}
  return <Button {...other}
    onClick={(e) => {
      console.log(release,"release");
      if (release) {
        EventHub.emit(release, {
          time: Date.now(), isUpdate: true,
          data: [
            {
              key: '1',
              name: 'John Brown',
              age: 32,
              address: 'New York No. 1 Lake Park',
              tags: ['nice', 'developer'],
            },
            {
              key: '2',
              name: 'John Brown',
              age: 32,
              address: 'New York No. 1 Lake Park',
              tags: ['nice', 'developer'],
            },
            {
              key: '3',
              name: 'John Brown',
              age: 32,
              address: 'New York No. 1 Lake Park',
              tags: ['nice', 'developer'],
            },
            {
              key: '4',
              name: 'John Brown',
              age: 32,
              address: 'New York No. 1 Lake Park',
              tags: ['nice', 'developer'],
            },
          ]
        })
      }
      if (onClick) { onClick('', e, superParams) }
    }}
  >{value}</Button>
}